﻿using System.Data;
using System.Windows.Forms;
using DevExpress.Utils;
using HouseRental.DataSets;

namespace HouseRental.Controls
{
    public partial class Family : Form
    {

        public FamiliaDataSet FamilyData
        {
            set { SetupFamilyData(value); }
        }

        public string FamilyName
        {
            get { return familyLookUpEdit.Text; }
        }

        private void SetupFamilyData(DataSet familyData)
        {
            familiaDataSet.Clear();
            familiaDataSet.Merge(familyData);
            familyLookUpEdit.Properties.DataSource = familiaDataSet.Familia;
            familyLookUpEdit.Properties.DisplayMember = familiaDataSet.Familia.NomeColumn.ToString();
            familyLookUpEdit.Properties.ValueMember = familiaDataSet.Familia.NomeColumn.ToString();
            familyLookUpEdit.Properties.Columns.Clear();
            familyLookUpEdit.Properties.Columns.AddRange(new[] {
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Nome", "Nome", 70, FormatType.None, "", true, HorzAlignment.Near)});
            familyLookUpEdit.ClosePopup();
        }

        public Family()
        {
            InitializeComponent();                      
        }

        
    }
}
